<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>5.2.3javascript基础-快速入门之循环语句</title>
</head>
<body>
  <script>
    var a = 45;
    a++;
    console.log(a)
    a++
    console.log(a)
    // for循环
    for(var i = 3; i < 10;i++) {
      console.log(i)
    }
    // 我们可以使用for循环去遍历数组
    var arr = ["我","你","他","它","她"]
    console.log("数组长度："+arr.length)
    // console.log(arr[0])
    // console.log(arr[1])
    // console.log(arr[2])
    console.log('下面是for循环')
    for(var i=0;i<arr.length;i++) {
      console.log(arr[i])
    }
    console.log('下面是while循环')
    var j = 0;
    while(j<arr.length) {
      console.log(arr[j])
      j++;
    }
    // 中断循环
    console.log('下面是中断循环')
    for(var i=0;i<arr.length;i++) {
      if(arr[i]=='他') {
        break;
      }
      console.log(arr[i])
    }
    // 中断当前循环
    console.log('下面是中断当前循环')
    for(var i=0;i<arr.length;i++) {
      if(arr[i]=='他') {
        continue;
      }
      console.log(arr[i])
    }
  </script>
</body>
</html>